﻿using System.Collections.Generic;

namespace WpfAdmin.Everything.Queryable {
    internal class ImageQueryable : Queryable, IImageQueryable {
        private string pattern;
        public ImageQueryable(IQueryGenerator parent)
            : base(parent) {
        }

        public IQuery Width(int width) {
            return this.Search($"width:{width}");
        }

        public IQuery Height(int height) {
            return this.Search($"height:{height}");
        }

        public IQuery Portrait() {
            return this.Search("orienation:portrait");
        }

        public IQuery Landscape() {
            return this.Search("orienation:landscape");
        }

        public IQuery BitDepth(Bpp bpp) {
            return this.Search($"bitdepth:{(int)bpp}");
        }

        private IQuery Search(string search) {
            this.pattern = search;
            return new Query(this);
        }

        public override IEnumerable<string> GetQueryParts() {
            foreach (var queryPart in base.GetQueryParts()) {
                yield return queryPart;
            }
            yield return this.pattern;
        }
    }
}
